<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Download extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		
		$this->load->model('Jobs');
		$this->load->helper('url');
		$this->load->helper('download');
	}
	
	function getfile()
	{
		$jid = $this->uri->rsegment(3, 0);
		$job = $this->Jobs->getJob($jid);
		
		$upDir = FCPATH."uploads/itinerary/".$job->origid;
		
		$data = file_get_contents($upDir."/".$job->filename);
		$name = $job->origname;
		
		force_download($name, $data); 
	}
}
?>